import React from 'react'
import { ALLSTATE, ITEMTYPE } from "../../../types/store.d"
import { useDispatch, useSelector } from "react-redux"
import { NavBar, Toast, ProductCard, Tag, Button } from 'react-vant';
import Hoclogin from "../../../utils/Hoclogin"
function Shopcar() {
  const shopcarArr = useSelector((state: ALLSTATE) => {
    return state.shopcarArr
  })
  return (
    <div>
      <NavBar
        title="购物车"
        leftText="返回"
        onClickLeft={() => Toast('返回')}
      />

      {
        shopcarArr && shopcarArr.length > 0 ? shopcarArr.map((item, index) => {
          return <ProductCard
            num="1"
            price={item.price}
            title={item.title}
            thumb={item.img}
            footer={
              <>
                <Button size="mini" round plain style={{ marginRight: 2 }}>
                 ++
                </Button>
                <Button size="mini" round plain>
                  --
                </Button>
              </>
            }
          />
        }) : "暂时没有数据"
      }
    </div>
  )
}

export default Hoclogin(Shopcar)